package edu.cicese.alz;

import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;

import java.util.ArrayList;

/**
 * Created by: Eduardo Quintana Contreras
 * Date: 26/01/12
 * Time: 01:12 PM
 */
public class Cluster implements Comparable<Cluster>{
	private int quantity = 1;
	private MapMarker markerA, markerB;
	private ArrayList<MapMarker> markers = new ArrayList<>();

	public void add(MapMarker m) {
		markers.add(m);
		quantity++;
	}

	public int compareTo(Cluster c) {
		return c.quantity - this.quantity;
	}

	public MapMarker getMarkerA() {
		return markerA;
	}

	public void setMarkerA(MapMarker markerA) {
		this.markerA = markerA;
	}

	public MapMarker getMarkerB() {
		return markerB;
	}

	public void setMarkerB(MapMarker markerB) {
		this.markerB = markerB;
	}

	public int getQuantity() {
		return quantity;
	}

	public ArrayList<MapMarker> getMarkers() {
		return markers;
	}

	public void removeDuplicates(ArrayList<MapMarker> addedMarkers) {
		markers.removeAll(addedMarkers);
		quantity = markers.size() + 1; // +1 because of the main marker
	}
}
